#!/bin/bash

export PAGER=less
export EDITOR=vim
alias ls='ls --color=auto'

export PS1='[root@winux \w]# '
export PATH=/usr/bin:/mingw64/bin:/cmd:/usr/bin/vendor_perl:/usr/bin/core_perl
export SSHARGS='-oConnectionAttempts=2 -oConnectTimeout=3 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oServerAliveCountMax=5 -oServerAliveInterval=20 -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa'

sshsvr() {
	local hostaddr="$1"
	if [ -z "${hostaddr}" ] ; then
		echo "Error, host address not specified." 1>&2
		return 1
	fi

	local port=22
	local user='root'
	[ -n "$2" ] && user="$2"
	[ -n "$3" ] && port="$3"

	ssh ${SSHARGS} -p "${port}" $4 "${user}@${hostaddr}"
	return $?
}
